package com.journey.org.ui.home.beauty.gankio

import android.app.Application
import androidx.databinding.ObservableArrayList
import androidx.databinding.ObservableInt
import com.journey.org.BR
import com.journey.org.R
import com.mvvmhabit.org.base.BaseViewModel
import com.mvvmhabit.org.binding.command.BindingAction
import com.mvvmhabit.org.binding.command.BindingCommand
import me.tatarka.bindingcollectionadapter2.ItemBinding

/**
 * @Date: 2020/11/24 16:38
 * @Author:小妖
 * @Description: 干货美女
 */
class GankIoGirlViewModel(application: Application) : BaseViewModel(application) {

    val requestStateField = ObservableInt()

    val onClickAgainLoadCommand = BindingCommand<Any>(object : BindingAction {
        override fun call() {
            page = 1
            loadBeautyGirlList()
        }
    })

    var page = 1

    val onRefreshCommand = BindingCommand<Any>(object : BindingAction {
        override fun call() {
            page = 1
            loadBeautyGirlList()
        }
    })

    val onLoadMoreCommand = BindingCommand<Any>(object : BindingAction {
        override fun call() {
            ++page
            loadBeautyGirlList()
        }
    })

    val itemBinding =
        ItemBinding.of<GankIoGirlItemViewModel>(BR.viewModel, R.layout.gank_io_girl_item)

    val items = ObservableArrayList<GankIoGirlItemViewModel>()

    fun loadBeautyGirlList() {

    }
}